package com.larly.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.larly.common.IdRequest;
import com.larly.model.domain.Notification;
import com.baomidou.mybatisplus.extension.service.IService;
import com.larly.model.dto.notification.NotificationCreateRequest;
import com.larly.model.dto.notification.NotificationSelectRequest;
import com.larly.model.vo.NotificationVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author 许颢达
* @description 针对表【notification(消息通知表)】的数据库操作Service
* @createDate 2025-09-02 12:31:02
*/
public interface NotificationService extends IService<Notification> {

    /**
     * 创建通知
     */
    boolean createNotification(NotificationCreateRequest notificationCreateRequest);

    /**
     * 构造查询条件
     */
    QueryWrapper<Notification> buildQueryWrapper(NotificationSelectRequest notificationSelectRequest);

    /**
     * 查询用户的通知
     */
    List<NotificationVO> queryUserNotification(QueryWrapper<Notification> queryWrapper,NotificationSelectRequest notificationSelectRequest);

    /**
     * 批量消息已读
     */
    boolean readBatchNotification(List<Integer> ids ,Integer userId);

    /**
     * 查询用户未读消息数量
     */
    long getUnreadCount(HttpServletRequest request);

    /**
     * 笔记点赞触发
     */
    void triggerNoteLikeNotify(Integer noteId, String noteTitle, Integer likerId, Integer noteAuthorId);

    /**
     * 笔记评论触发
     */
    void triggerNoteCommentNotify(Integer noteId, String noteTitle,String commentContent, Integer commenterId, Integer noteAuthorId);

    /**
     * 评论点赞触发
     */
    void triggerCommentLikeNotify(Integer commentId, String commentContent, Integer likerId, Integer commentAuthorId);

    /**
     * 评论回复触发
     */
    void triggerCommentReplyNotify(Integer parentInteractionId, String parentContent, Integer replierId, Integer interactionAuthorId);

    /**
     * 用户关注
     */
    void triggerFollowNotify(Integer followerId, Integer followedId);

    /**
     * 用户发送消息
     */
    void triggerPrivateMessageNotify(Integer senderId, Integer receiverId, String content);
}
